using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace DataStructure
{
    public class Array1Queue<T> : IQueue<T>
    {
        private Array1<T> arr;
        public int Count => arr.Count;

        public bool IsEmpty => arr.IsEmpty;

        public Array1Queue(int capacity)
        {
            arr = new Array1<T>(capacity);
        }
        public Array1Queue()
        {
            arr = new Array1<T>();    
        }
        //入队
        public void Enqueue(T data)
        {
            arr.AddLast(data);
        }
        //出队
        public T Dequeue()
        {
            return arr.RemoveFirst();
        }
        //查看队首元素
        public T Peek()
        {
            return arr.GetFirst();
        }
        public override string ToString()
        {
            return "Queue: Head" + arr.ToString() + "Tail";
        }
    }
}